import {SETDEFAULT, SETTOKEN} from "./constant.js";
import deepClone from "../tools/deepClone.js";

const defaultState = {default: 'default', token: ''};
const reducer = (state = defaultState, action) => {
    const obj = deepClone(state);
    switch (action.type) {
        case SETDEFAULT:
            obj.default = action.value;
            return obj;
        case SETTOKEN:
            obj.token = action.value;
            return obj;
    }
    return state;
}
export default reducer;